package com.liulimi.fastapi.core.exception;

import com.liulimi.fastapi.application.controller.Demo;
import com.liulimi.fastapi.core.http.Request;
import com.liulimi.fastapi.core.http.response.ResultEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;

/**
 * @author Wenbo
 * @date 2021/1/8 11:09
 * @Email 969100115@qq.com
 * @phone 17621847037
 */
public class BaseException extends RuntimeException {
    int code;
    String description;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public BaseException(ResultEnum resultEnum){
        super(resultEnum.getMessage());
        this.description = resultEnum.getMessage();
        this.code = resultEnum.getCode();
    }

    public BaseException(ResultEnum resultEnum,String description){
        super(resultEnum.getMessage());
        this.code = resultEnum.getCode();
        this.description = description;
    }

    public BaseException(String description) {
        super(description);
    }

    public BaseException(String description, Throwable cause) {
        super(description, cause);
    }

}
